package leetcode.code0790;

import leetcode.IDebug;

public class Solution implements IDebug {

	int mod = (int) 1e9 + 7;

	public int numTilings(int n) {
		long[] a = new long[n + 1];// 以丨结尾
		long[] b = new long[n + 1];// 上点
		long[] c = new long[n + 1];// 下点
		a[0] = 1;
		a[1] = 1;
		for (int i = 2; i <= n; i++) {
			a[i] = a[i - 1] + a[i - 2] + b[i - 1] + c[i - 1];
			b[i] = a[i - 2] + c[i - 1];
			c[i] = a[i - 2] + b[i - 1];
			a[i] %= mod;
			b[i] %= mod;
			c[i] %= mod;
		}
		return (int) a[n];
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
